package com.proj.hsy;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainWebView extends Activity implements WebViewInterface{

	private WebView inAppWebView;
	private String CallbackId;
	
	@SuppressWarnings("deprecation")
	@SuppressLint({ "NewApi", "SetJavaScriptEnabled" })
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		 // WebView
        inAppWebView = (WebView)findViewById(R.id.webView);
        inAppWebView.setWebChromeClient(new WebChromeClient());
        WebViewClient client = new InAppBrowserClient(this,inAppWebView);
        inAppWebView.setWebViewClient(client);
        WebSettings settings = inAppWebView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setBuiltInZoomControls(true);

        settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
        settings.setDomStorageEnabled(true);
        inAppWebView.loadUrl("file:///android_asset/www/login.html");
        inAppWebView.setId(1);
        inAppWebView.getSettings().setLoadWithOverviewMode(true);
        inAppWebView.getSettings().setUseWideViewPort(true);
        inAppWebView.requestFocus();
        inAppWebView.requestFocusFromTouch();
	}
	@Override
	public Activity getActivity() {
		return this;
	}
	@Override
	public Context getContext() {
		return this;
	}
	@Override
	public void setCallbackId(String callbackId) {
		this.CallbackId = callbackId;
	}
	@Override
	public String getViewName() {
		return "MainActivity";
	}
}
